package com.java.zhuiyun.api.pictureidiomlevel.controller;

import com.java.zhuiyun.annotation.OptLog;
import com.java.zhuiyun.api.pictureidiomlevel.entity.PictureIdiomLevel;
import com.java.zhuiyun.api.pictureidiomlevel.service.PictureIdiomLevelService;
import com.java.zhuiyun.common.response.CommonConstants;
import com.java.zhuiyun.common.response.CommonResult;
import com.java.zhuiyun.util.pageUtil.PageRequest;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName PrictrueIdiomLevelController
 * @Description TODO
 * @Author MJL
 * @Date 2023/9/14 8:35
 **/
@RestController
@RequestMapping("/PictureIdiomLevel")
public class PictureIdiomLevelController {
    @Resource
    PictureIdiomLevelService pictureIdiomLevelService;
    /**
    * @Author MJL
    * @Description todo 添加关卡
    * @Date 2023/9/14 8:43
    * @Return  * @param nullza
    */
    @PostMapping("/addPictureIdiomLevel")
    @ApiOperation(value = "看图猜成语后台管理系统添加关卡")
    @OptLog(modular = "看图猜成语关卡信息管理", type = CommonConstants.UPDATE, describe = "看图猜成语添加关卡")
    public CommonResult addPictureIdiomLevel(PictureIdiomLevel pictureIdiomLevel) {
        return pictureIdiomLevelService.addPictureIdiomLevel(pictureIdiomLevel);
    }
    /**
     * @Author MJL
     * @Description todo 查询全部看图猜成语关卡
     * @Date 2023/9/14 11:38
     * @Return * @param null
     */
    @GetMapping("/queryPictureIdiomLevel")
    @ApiOperation(value = "看图猜成语后台管理系统查询关卡")
    @OptLog(modular = "看图猜成语关卡信息管理", type = CommonConstants.UPDATE, describe = "看图猜成语查询关卡")
    public CommonResult queryPictureIdiomLevel(PictureIdiomLevel pictureIdiomLevel, PageRequest pageRequest) {
        return CommonResult.ok(pictureIdiomLevelService.queryPictureIdiomLevel(pictureIdiomLevel,pageRequest));
    }
    /**
    * @Author MJL
    * @Description todo 查询出当前关卡的成语
    * @Date 2023/9/20 8:47
    * @Return  * @param null
    */
    @GetMapping("/queryLevelIdiom")
    public CommonResult queryLevelIdiom(Integer id , PageRequest pageRequest) {
        return CommonResult.ok(pictureIdiomLevelService.queryLevelIdiom(id,pageRequest));
    }
    /**
    * @Author MJL
    * @Description todo 将关卡下架
    * @Date 2023/10/16 20:23
    * @Return  * @param null
    */
    @PostMapping("/bannedLevel")
    @ApiOperation(value = "看图猜成语后台管理系统下架关卡")
    @OptLog(modular = "看图猜成语关卡信息管理", type = CommonConstants.UPDATE, describe = "看图猜成语下架关卡")
    public CommonResult bannedLevel(Integer id) {
        return CommonResult.ok(pictureIdiomLevelService.bannedLevel(id));
    }
    /**
    * @Author MJL
    * @Description todo 将关卡上架
    * @Date 2023/10/16 20:31
    * @Return  * @param null
    */
    @PostMapping("/enableLevel")
    @ApiOperation(value = "看图猜成语后台管理系统上架关卡")
    @OptLog(modular = "看图猜成语关卡信息管理", type = CommonConstants.UPDATE, describe = "看图猜成语上架关卡")
    public CommonResult enableLevel(Integer id) {
        return CommonResult.ok(pictureIdiomLevelService.enableLevel(id));
    }
}
